<template>
  <div>
    <banner2 :taskdata="taskData"></banner2>
    <div class="left">
      <div v-for="(item,index) in container.items" :key="item.id" v-if="item.belong == 'left'&&(taskData.Mode!=2||item.id!='Tickettype')">
        <div :is="item.id" :ref="item.id" :moddata="item" :index="index" :taskdata="taskData"></div>
      </div>
    </div>
    <div class="right">
      <div v-for="(item,index) in container.items" :key="item.id" v-if="item.belong == 'right'&&(taskData.Mode!=2||item.id!='Tickettype')">
        <div :is="item.id" :ref="item.id" :moddata="item" :index="index" :taskdata="taskData"></div>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from 'vuex'
  import banner2 from '../components/banner2.vue'
  import eventdetails from '../components/eventdetails.vue'
  import Tickettype from '../components/Tickettype.vue'
  import timelocation from '../components/timelocation.vue'
  import Sponsor from '../components/Sponsor.vue'
  import eventschedule from '../components/eventschedule.vue'
  import myMod from '../components/myMod.vue'
  export default {
    components: {
      banner2,
      eventdetails,
      Tickettype,
      timelocation,
      Sponsor,
      eventschedule,
      myMod
    },
    data() {
      return {
        taskData: {
          "TaskId": "",
          "ActivityTitle": "",
          "StartTime": "",
          "EndTime": "",
          "CutOffTime": "",
          "Coordinate": "",
          "ActivityLocation": "",
          "ActivityCity": "",
          "AllTickets": [],
          "Summary": "",
          "APost": "",
          "Mode": 1,
          "IsEnd": false,
          "UserId": "",
          "TicketCount": 0,
          "CanManage": true,
          "Sponsor": []
        },
      }
    },
    created() {
      var that = this;
      $.ajax("/Event/Manage/GetTaskData", {
        type: "post",
        contentType: "application/json",
        headers: {
          ISGZIPDATA: "0"
        },
        data: JSON.stringify({
          taskId: that.parameters.taskId,
        }),
        beforeSend: function () {
          that.setAllloading(true);
        },
        success: function (data) {
          // console.log(data)
          data.AllTickets.forEach(function (item) {
            if (data.AllTickets.length == 1) {
              item.count = 0;
            } else {
              item.count = 0;
            }
          });
          document.title = data.ActivityTitle;
          that.taskData = data;
          that.setAllloading(false);
        },
        error: function (err) {
          console.log(err)
        }
      });
    },
    computed: {
      ...mapState([
        'container',
        'pageConfig',
        'allloading',
        "parameters"
      ]),
    },
    methods: {
      ...mapMutations([
        'setAllloading'
      ])
    }
  }
</script>

<style scoped>
</style>